<template>
<div>
<el-card>
  <el-button v-has-role="true">你有权限修改</el-button>
  <el-button v-has-role="false">无权限修改</el-button>
</el-card>
</div>
</template>

<script>
export default {
  name: "directive",
  data(){
    return{
      // hasPermissions:true
    }
  },
  directives:{
    hasRole:{
      inserted(el,binding){
        const {value}=binding
        if (!value) {
          el.parentNode && el.parentNode.removeChild(el)
        }
      }
    }
  }
}
</script>

<style scoped>

</style>
